package com.csxy.lsh.Controller;

import com.csxy.lsh.R;
import com.csxy.lsh.service.OssService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name="oss" ,description = "上传文件接口")
@RestController
@RequestMapping("/edu_oss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
@Operation(summary = "上传图片")
@PostMapping("upload")
    public R uploadFile(@RequestParam("file")MultipartFile file){
        String url = ossService.uploadFileAvatar(file);
        return R.ok().data("url",url).message("文件上传成功");
    }
}
